//
// Created by kirillg on 02.06.24.
//

#include "TestDiploma.h"
#include "src/Surface.h"
#include "src/Cell.h"
#include "src/Control.h"
#include "src/Climate.h"
#include "src/Image.h"
#include "eggx.h"
#include "eggx_color.h"
GTEST_TEST_F(TestDiploma, max_height_check) {
    Surface surf(30, 100, 3);
    ASSERT_LE(surf.max_height(), 100);
}

GTEST_TEST_F(TestDiploma, min_height_check) {
    Surface surf(30, 100, 3);
    ASSERT_GE(surf.min_height(), 30);
}

GTEST_TEST_F(TestDiploma, min_condition_check) {
    Surface surf(30, 100, 1);
    surf.rain();
    ASSERT_GE(surf.min_condition(), 1);
}

GTEST_TEST_F(TestDiploma, max_condition_check) {
    Surface surf(30, 100, 1);
    surf.rain();
    ASSERT_LE(surf.max_condition(), 17);
}

GTEST_TEST_F(TestDiploma, total_condition_check_step_0) {
    Surface surf(30, 100, 1);
    ASSERT_EQ(surf.get_total_condition(), 0);
}

GTEST_TEST_F(TestDiploma, total_condition_check_step_1) {
    Surface surf(30, 100, 1);
    surf.rain();
    ASSERT_EQ(surf.get_total_condition(), 8*70*70);
}

GTEST_TEST_F(TestDiploma, total_condition_check_step_40) {
    Surface surf(30, 100, 1);
    for (int i = 0 ; i != 40; i++) {
        surf.rain();
    }
    ASSERT_EQ(surf.get_total_condition(), 8*70*70*40);
}

GTEST_TEST_F(TestDiploma, cell_default_condition) {
    Cell cell;
    ASSERT_EQ(cell.get_condition(), 0);
}

GTEST_TEST_F(TestDiploma, cell_default_height) {
    Cell cell;
    ASSERT_EQ(cell.get_hight(), 0);
}

GTEST_TEST_F(TestDiploma, cell_height) {
    Cell cell(5);
    ASSERT_EQ(cell.get_hight(), 5);
}

GTEST_TEST_F(TestDiploma, Control_default_num_of_steps) {
    Control control;
    ASSERT_EQ(control.get_number_of_steps(), 100);
}

GTEST_TEST_F(TestDiploma, Control_default_current_steps) {
    Control control;
    ASSERT_EQ(control.get_current_steps(), 0);
}

GTEST_TEST_F(TestDiploma, Control) {
    Control control(100, 100, 30, 1);
    ASSERT_EQ(control.get_number_of_steps(), 100);
}

GTEST_TEST_F(TestDiploma, Control_make_step) {
    Control control(100, 100, 30, 1);
    control.make_step();
    ASSERT_EQ(control.get_model().get_total_condition(), 8*70*70);
}

GTEST_TEST_F(TestDiploma, Control_simulate) {
    Control control(10, 100, 30, 1);
    control.simulate();
    ASSERT_EQ(control.get_model().get_total_condition(), 8*70*70*10);
}

GTEST_TEST_F(TestDiploma, climate_default_rain_volume) {
    Climate cli;
    ASSERT_EQ(cli.get_rain_volume(), 8);
}

GTEST_TEST_F(TestDiploma, climate_rain_volume) {
    Climate cli;
    cli.set_rain_volume(3);
    ASSERT_EQ(cli.get_rain_volume(), 3);
}

GTEST_TEST_F(TestDiploma, climate_default_rain_probability) {
    Climate cli;
    ASSERT_EQ(cli.get_rain_probability(), 0.0);
}

GTEST_TEST_F(TestDiploma, climate_rain_probability) {
    Climate cli;
    cli.set_rain_probability(0.7);
    ASSERT_EQ(cli.get_rain_probability(), 0.7);
}

GTEST_TEST_F(TestDiploma, draw_surface) {
    Surface surf(30, 100, 1);
    Image img;
    ASSERT_EQ(img.draw(surf, DS9_GREEN), 1);
}

GTEST_TEST_F(TestDiploma, draw_water) {
    Surface surf(30, 100, 1);
    Image img;
    ASSERT_EQ(img.draw(surf, DS9_BLUE), 2);
}

//
//int main(int argc, char** argv) {
//    testing::InitGoogleTest(&argc, argv);
//    return RUN_ALL_TESTS();
//}